package com.lzy.principles.demo2.after;

/**
 * @ClassName: RectangleDemo
 * @Description: TODO
 * @Author: LiuZy
 * @Date: 2022/4/4 10:24
 * @Version: 1.0
 */
public class RectangleDemo {

    public static void main(String[] args) {

        Rectangle rectangle = new Rectangle();
        rectangle.setLength(20);
        rectangle.setWidth(19);

        reset(rectangle);
        print(rectangle);

        System.out.println("=================");

        Square square = new Square();
        square.setSide(10);
        print(square);

    }

    private static void reset(Rectangle rectangle){
        while(rectangle.getWidth() <= rectangle.getLength()){
            rectangle.setWidth(rectangle.getWidth()+1);
        }
    }

    private static void print(Quadrilateral quadrilateral){
        System.out.println(String.format("长：%s, 宽：%s", quadrilateral.getLength(), quadrilateral.getWidth()));
    }
}